package com.itlong.cloud.operate.resource;

import com.itlong.cloud.POJO.DTO.operate.OperateAssessFunctionDTO;
import com.itlong.cloud.POJO.VO.operate.OperateAssessFunctionVO;
import com.itlong.cloud.POJO.VO.operate.OperateGetRoleMenuVO;
import com.itlong.cloud.noncore.operate.IOperateAssessFunctionServiceClient;
import com.itlong.cloud.operate.service.IOperateAssessFunctionService;
import com.itlong.cloud.utils.page.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * <desc>
 *      运营-报价系统接口暴露实现类
 * </desc>
 *
 * @createDate2020/6/8
 **/
@RestController
public class OperateAssessFunctionServiceResource implements IOperateAssessFunctionServiceClient {

    @Autowired
    private IOperateAssessFunctionService iOperateAssessFunctionService;

    /**
     * <desc>
     *      分页获取报价菜单
     * </desc>
     *
     * @param operateAssessFunctionDTO 报价菜单DTO
     * @return
     * @Author Zhu.yj
     * @createDate  2020/6/9
     */
    @PostMapping("/operate/system/assessFunction/getPage")
    @Override
    public Page<OperateAssessFunctionVO> getPage(@RequestBody OperateAssessFunctionDTO operateAssessFunctionDTO) throws Exception {
        return iOperateAssessFunctionService.getPage(operateAssessFunctionDTO);
    }

    /**
     * <desc>
     *      获取单个报价菜单
     * </desc>
     *
     * @param operateAssessFunctionDTO 报价菜单DTO
     * @return
     * @Author Zhu.yj
     * @createDate  2020/6/9
     */
    @PostMapping("/operate/system/assessFunction/getOne")
    @Override
    public OperateAssessFunctionVO getOne(@RequestBody OperateAssessFunctionDTO operateAssessFunctionDTO) throws Exception {
        return iOperateAssessFunctionService.getOne(operateAssessFunctionDTO);
    }

    /**
     * <desc>
     *      获取子节点
     * </desc>
     *
     * @param operateAssessFunctionDTO 报价菜单DTO
     * @return
     * @Author Zhu.yj
     * @createDate  2020/6/9
     */
    @PostMapping("/operate/system/assessFunction/getChild")
    @Override
    public List<OperateAssessFunctionVO> getChild(@RequestBody OperateAssessFunctionDTO operateAssessFunctionDTO) throws Exception {
        return iOperateAssessFunctionService.getChild(operateAssessFunctionDTO);
    }


    /**
     * <desc>
     *      更改菜单状态
     * </desc>
     *
     * @param operateAssessFunctionDTO 报价菜单DTO
     * @return
     * @Author Zhu.yj
     * @createDate  2020/6/9
     */
    @PostMapping("/operate/system/assessFunction/updateStatus")
    @Override
    public Integer updateStatus(@RequestBody OperateAssessFunctionDTO operateAssessFunctionDTO) throws Exception {
        return iOperateAssessFunctionService.updateStatus(operateAssessFunctionDTO);
    }

    /**
     * <desc>
     *      保存操作
     * </desc>
     *
     * @param operateAssessFunctionDTO 报价菜单DTO
     * @return
     * @Author Zhu.yj
     * @createDate  2020/6/9
     */
    @PostMapping("/operate/system/assessFunction/save")
    @Override
    public Integer save(@RequestBody OperateAssessFunctionDTO operateAssessFunctionDTO) throws Exception {
        return iOperateAssessFunctionService.save(operateAssessFunctionDTO);
    }

    /**
     * <desc>
     *      更新操作
     * </desc>
     *
     * @param operateAssessFunctionDTO 报价菜单DTO
     * @return
     * @Author Zhu.yj
     * @createDate  2020/6/9
     */
    @PostMapping("/operate/system/assessFunction/update")
    @Override
    public Integer update(@RequestBody OperateAssessFunctionDTO operateAssessFunctionDTO) throws Exception {
        return iOperateAssessFunctionService.update(operateAssessFunctionDTO);
    }

    /**
     * <desc>
     *      删除功能
     * </desc>
     *
     * @param operateAssessFunctionDTO 报价菜单DTO
     * @return
     * @Author Zhu.yj
     * @createDate  2020/6/16
     */
    @PostMapping("/operate/system/assessFunction/delete")
    @Override
    public Integer delete(@RequestBody OperateAssessFunctionDTO operateAssessFunctionDTO) throws Exception {
        return iOperateAssessFunctionService.delete(operateAssessFunctionDTO);
    }

    /**
     * <desc>
     *      获取当前节点所有同级节点
     * </desc>
     *
     * @param parent
     * @return
     * @Author Zhu.yj
     * @createDate  2020/6/16
     */
    @PostMapping("/operate/system/assessFunction/getParentLevelFunctions")
    @Override
    public List<Map<String, Object>> getParentLevelFunctions(@RequestParam("parent") String parent) throws Exception {
        return iOperateAssessFunctionService.getParentLevelFunctions(parent);
    }

    /**
     * <desc>
     *      获取角色菜单
     * </desc>
     *
     * @param roleId 角色id
     * @return
     * @Author Zhu.yj
     * @createDate  2020/6/22
     */
    @PostMapping("/operate/system/assessFunction/getRoleMenus")
    @Override
    public List<OperateGetRoleMenuVO> getRoleMenus(@RequestParam("roleId") String roleId) {
        return iOperateAssessFunctionService.getRoleMenus(roleId);
    }


}
